﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
                    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
                    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
                    xmlns:models="clr-namespace:Oddo.Concept.Crm.Common.ViewModels;assembly=Oddo.Concept.Crm.Common"
                    xmlns:resources="clr-namespace:Oddo.Concept.Crm.Common.Presentation.Resources" 
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:controls="clr-namespace:Oddo.Concept.Crm.Common.Presentation.Controls">
    
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

    <Style x:Key="ImageCancelStyle" TargetType="{x:Type Image}">
        <Setter Property="Source" Value="/Oddo.Concept.Crm.Common.Presentation;component/Images/stop.png"/>
        <Setter Property="Width" Value="20"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="Stretch" Value="Fill"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Margin" Value="1"/>
    </Style>

    <Style x:Key="SplashWindowStyle" TargetType="{x:Type Window}">
        <Setter Property="ShowInTaskbar" Value="False"></Setter>
        <Setter Property="ResizeMode" Value="NoResize"></Setter>
        <Setter Property="WindowStyle" Value="None"></Setter>
        <Setter Property="SizeToContent" Value="WidthAndHeight"></Setter>
        <Setter Property="Topmost" Value="True"></Setter>
        <Setter Property="AllowsTransparency" Value="True"></Setter>
        <Setter Property="MinWidth" Value="400"></Setter>
        <Setter Property="MinHeight" Value="200"></Setter>
    </Style>

    <Style TargetType="{x:Type dxb:BarManager}">
        <Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
        <Setter Property="VerticalAlignment" Value="Stretch"></Setter>
        <Setter Property="VerticalAlignment" Value="Stretch"></Setter>
        <Setter Property="AllowCustomization" Value="False"></Setter>
        <Setter Property="AllowQuickCustomization" Value="False"></Setter>
        <Setter Property="AllowHotCustomization" Value="False"></Setter>
    </Style>

    <Style TargetType="{x:Type dxb:Bar}">
        <Setter Property="AllowCustomizationMenu" Value="False"></Setter>
        <Setter Property="AllowQuickCustomization" Value="False"></Setter>
        <Setter Property="AllowHide" Value="False"></Setter>
        <Setter Property="ShowDragWidget" Value="False"></Setter>
    </Style>


    <Style x:Key="BusyPanelStyle" TargetType="{x:Type ContentControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border CornerRadius="3" Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Border.Background>
                            <SolidColorBrush Color="Black" Opacity="0.5"/>
                        </Border.Background>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <ProgressBar IsIndeterminate="True" Width="70" Height="18" Grid.Row="0" HorizontalAlignment="Right" Margin="5"/>
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1">
                                <TextBlock Text="{Binding Path=BusyText, RelativeSource={RelativeSource TemplatedParent}}" FontWeight="DemiBold" Foreground="White" Margin="0,10"/>
                                <Button HorizontalAlignment="Center" MinWidth="75" IsEnabled="{Binding CanCancelOperation}" Command="{Binding CancelCommand}">
                                    <StackPanel Orientation="Horizontal">
                                        <Image Style="{StaticResource ImageCancelStyle}"/>
                                        <TextBlock Text="{Binding Path=CancelButtonText, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0" VerticalAlignment="Center"/>
                                    </StackPanel>
                                </Button>
                            </StackPanel>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsBusy}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Name="busyStoryBoard">
                                    <Storyboard>
                                        <DoubleAnimation 
                                            Storyboard.TargetProperty="Opacity"
                                            From="0"
                                            To="1"
                                            Duration="00:00:00.5"></DoubleAnimation>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <RemoveStoryboard BeginStoryboardName="busyStoryBoard"/>
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
  
</ResourceDictionary>